<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.29
     from name.tnf on 19 December 2010 -->

<TITLE>Name analysis according to scope rules - Joined Ranges</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000" BACKGROUND="gifs/bg.gif">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0" VALIGN=BOTTOM>
<TR VALIGN=BOTTOM>
<TD WIDTH="160" VALIGN=BOTTOM>
<A HREF="http://eli-project.sourceforge.net/">
<IMG SRC="gifs/elilogo.gif" BORDER=0>
</A>&nbsp;
</TD>
<TD WIDTH="25" VALIGN=BOTTOM>
<img src="gifs/empty.gif" WIDTH=25 HEIGHT=25>
</TD>
<TD ALIGN=LEFT WIDTH="475" VALIGN=BOTTOM>
<A HREF="index.html"><IMG SRC="gifs/title.png" BORDER=0></A>
</TD>
<!-- |DELETE FOR SOURCEFORGE LOGO|
<TD>
<a href="http://sourceforge.net/projects/eli-project">
<img
  src="http://sflogo.sourceforge.net/sflogo.php?group_id=70447&amp;type=13"
  width="120" height="30"
  alt="Get Eli: Translator Construction Made Easy at SourceForge.net.
    Fast, secure and Free Open Source software downloads"/>
</a>
</TD>
|DELETE FOR SOURCEFORGE LOGO| -->
</TR>
</TABLE>

<HR size=1 noshade width=785 align=left>
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
<TR>
<TD VALIGN=TOP WIDTH="160">
<h4>General Information</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="index.html">Eli: Translator Construction Made Easy</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="gindex_1.html#SEC1">Global Index</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="faq_toc.html" >Frequently Asked Questions</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Tutorials</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="EliRefCard_toc.html">Quick Reference Card</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="novice_toc.html">Guide For new Eli Users</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="news_toc.html">Release Notes of Eli</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="nametutorial_toc.html">Tutorial on Name Analysis</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="typetutorial_toc.html">Tutorial on Type Analysis</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Reference Manuals</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ui_toc.html">User Interface</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="pp_toc.html">Eli products and parameters</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lidoref_toc.html">LIDO Reference Manual</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ee.html" >Typical Eli Usage Errors</a> </td></tr>
</table>

<h4>Libraries</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lib_toc.html">Eli library routines</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="modlib_toc.html">Specification Module Library</a></td></tr>
</table>

<h4>Translation Tasks</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lex_toc.html">Lexical analysis specification</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="syntax_toc.html">Syntactic Analysis Manual</a></td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="comptrees_toc.html">Computation in Trees</a></td></tr>
</table>

<h4>Tools</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="lcl_toc.html">LIGA Control Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="show_toc.html">Debugging Information for LIDO</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="gorto_toc.html">Graphical ORder TOol</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="fw_toc.html">FunnelWeb User's Manual</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="ptg_toc.html">Pattern-based Text Generator</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="deftbl_toc.html">Property Definition Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="oil_toc.html">Operator Identification Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="tp_toc.html">Tree Grammar Specification Language</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="clp_toc.html">Command Line Processing</a> </td></tr>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="cola_toc.html">COLA Options Reference Manual</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="idem_toc.html">Generating Unparsing Code</a> </td></tr>
</table>
<p>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="mon_toc.html">Monitoring a Processor's Execution</a> </td></tr>
</table>

<h4>Administration</h4>

<table BORDER=0 CELLSPACING=0 CELLPADDING=0>
<tr valign=top><td><img src="gifs/gelbekugel.gif" WIDTH=7 HEIGHT=7 ALT=" o"> </td><td><a href="sysadmin_toc.html">System Administration Guide</a> </td></tr>
</table>

<HR WIDTH="100%">
<A HREF="mailto:eli-project-users@lists.sourceforge.net">
<IMG SRC="gifs/button_mail.gif" BORDER=0 ALIGN="left"></A>
<A HREF="index.html"><IMG SRC="gifs/home.gif" BORDER=0 ALIGN="right"></A>

</TD>
<TD VALIGN=TOP WIDTH="25"><img src="gifs/empty.gif" WIDTH=25 HEIGHT=25></TD>

<TD VALIGN=TOP WIDTH="600">
<H1>Name analysis according to scope rules</H1>
<P>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_3.html"><IMG SRC="gifs/prev.gif" ALT="Previous Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_5.html"><IMG SRC="gifs/next.gif" ALT="Next Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_toc.html"><IMG SRC="gifs/up.gif" ALT="Table of Contents" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT="">
<HR size=1 noshade width=600 align=left>
<H1><A NAME="SEC7" HREF="name_toc.html#SEC7">Joined Ranges</A></H1>
<P>
In some situations it is not possible to specify the tree grammar
such that each range in the sense of scope rules is rooted
by one single grammar symbol as required for using the role
<CODE>RangeScope</CODE> of the basic scope module.
The following three modules extend the basic scope rule modules
(see  <A HREF="name_2.html#SEC2">Basic Scope Rules</A>) by facilities that support such cases:
<P>
<DL COMPACT>
<DT><CODE>AlgRangeSeq</CODE>
<DD>Joined Ranges Algol-like
<DT><CODE>CRangeSeq</CODE>
<DD>Joined Ranges C-like
<DT><CODE>BuRangeSeq</CODE>
<DD>Joined Ranges C-like Bottom-up
</DL>
<P>
Using one of these modules requires that the corresponding
basic scope rule module is instantiated with the same generic parameters
<CODE>+instance=NAME</CODE> and <CODE>+referto=KEY</CODE>.
<P>
This module implements the following concept:
Several ranges in the program form one single range in the sense
of scope rules, i.e. the definition in these ranges contribute
to a single scope in which the applied identifier occurrences
of these ranges are bound.
There is a symbol which is the subtree root for all these ranges.
But it is not a range in the sense of scope rules because it
may also contain identifier occurrences that are bound in the
enclosing range.
<P>
The modules provide <CODE>.lido</CODE> specifications for the following
computational roles:
<A NAME="IDX124"></A>
<P>
<CODE>NAMERangeSequence</CODE>
is to be inherited by a symbol that is the root of a subtree
which contains all to be joined ranges.
It provides all attributes provided by <CODE>NAMERangeScope</CODE>,
but it is not a range in the sense of scope rules.
Other range roles may not be inherited by <CODE>NAMERangeSequence</CODE>.
<A NAME="IDX125"></A>
<P>
<CODE>NAMERangeElement</CODE>
is the role to be inherited by symbols that represent
ranges to be joined. It is a specialized <CODE>NAMERangeScope</CODE>.
Other range roles may not be inherited by such a symbol.
It is a specialized <CODE>NAMERangeScope</CODE> that must be contained in a
<CODE>NAMERangeSequence</CODE> subtree without
having a <CODE>NAMERangeScope</CODE> in between.
<P>
We demonstrate the use of these facilities by extending the language
of our running example by introducing an artificial language
construct: It consists of a defining identifier occurrence,
that is to be bound in the enclosing range,
and two compound statements which form one single range in the sense
of scope rules:
<P>
<PRE>
   Statement:      Join.
   Join:           'join' DefIdent JoinedBlock JoinedBlock 
                   'joined' ';'.
   JoinedBlock:    Compound.
</PRE>
<P>
Hence the <CODE>Join</CODE> symbol has the role <CODE>RangeSequence</CODE>,
and the <CODE>JoinedBlock</CODE> symbol has the role <CODE>RangeElement</CODE>:
<P>
<PRE>
   RULE: Join ::= 'join' DefIdent JoinedBlock JoinedBlock 
                  'joined' ';'
   END;

   SYMBOL Join INHERITS RangeSequence END;
   SYMBOL JoinedBlock INHERITS RangeElement END;
</PRE>
<P>
This example is applicable with either the <CODE>AlgRangeSeq</CODE>
module or the <CODE>CRangeSeq</CODE>.
In case of Algol-like scope rules an applied identifier occurrence
in either of the two ranges may be bound to a definition
in either of the two ranges.
In case of C-like scope rules an applied identifier occurrence
in the second of the two ranges may be bound to a definition
in either of the two ranges.
<P>
In case of bottom-up computations
using the <CODE>BuRangeSeq</CODE> module some modifications have to be applied
as described for that module.
<P>
<A NAME="IDX126"></A>
<H2><A NAME="SEC8" HREF="name_toc.html#SEC8">Joined Ranges Algol-like</A></H2>
<P>
This module implements joined ranges for Algol-like scope rules
as described in (see  <A HREF="name_4.html#SEC7">Joined Ranges</A>).
<P>
The module is instantiated by
<PRE>
   $/Name/AlgRangeSeq.gnrc+instance=NAME +referto=KEY :inst
</PRE>
<P>
Using this module requires that the module <CODE>AlgScope</CODE> is instantiated
with the same values of the generic parameters.
<P>
The module provides the computational roles 
<CODE>NAMERangeSequence</CODE> and <CODE>NAMERangeElement</CODE>
as described in See  <A HREF="name_4.html#SEC7">Joined Ranges</A>.
<P>
<A NAME="IDX127"></A>
<H2><A NAME="SEC9" HREF="name_toc.html#SEC9">Joined Ranges C-like</A></H2>
<P>
This module implements joined ranges for C-like scope rules
as described in (see  <A HREF="name_4.html#SEC7">Joined Ranges</A>).
<P>
The module is instantiated by
<PRE>
   $/Name/CRangeSeq.gnrc+instance=NAME +referto=KEY :inst
</PRE>
<P>
Using this module requires that the module <CODE>CScope</CODE> is instantiated
with the same values of the generic parameters.
<P>
The module provides the computational roles 
<CODE>NAMERangeSequence</CODE> and <CODE>NAMERangeElement</CODE>
as described in See  <A HREF="name_4.html#SEC7">Joined Ranges</A>.
<P>
<A NAME="IDX129"></A>
<A NAME="IDX130"></A>
<A NAME="IDX128"></A>
<H2><A NAME="SEC10" HREF="name_toc.html#SEC10">Joined Ranges C-like Bottom-up</A></H2>
<P>
This module implements joined ranges for C-like scope rules
as described in (see  <A HREF="name_4.html#SEC7">Joined Ranges</A>).
Its computations are executed <CODE>BOTTOMUP</CODE> while the
input is read.
<P>
The module is instantiated by
<PRE>
   $/Name/BuRangeSeq.gnrc+instance=NAME +referto=KEY :inst
</PRE>
<P>
Using this module requires that the module <CODE>BuScope</CODE> is instantiated
with the same values of the generic parameters.
<P>
The module provides the computational roles 
<CODE>NAMERangeSequence</CODE>, <CODE>NAMEOpenSeqScope</CODE> and 
<CODE>NAMEOpenElemScope</CODE>.
<A NAME="IDX132"></A>
<A NAME="IDX133"></A>
<A NAME="IDX131"></A>
<P>
<CODE>NAMERangeSequence</CODE>
is to be inherited by a symbol that is the root of a subtree
which contains all to be joined ranges.
It provides all attributes provided by <CODE>NAMERangeScope</CODE>,
but it is not a range in the sense of scope rules.
Other range roles may not be inherited by <CODE>NAMERangeSequence</CODE>.
<P>
<CODE>NAMEOpenSeqScope</CODE>
is to be inherited by a symbol that is in the subtree of
<CODE>NAMERangeSequence</CODE> and precedes all to be joined ranges.
<P>
<CODE>NAMEOpenElemScope</CODE>
is to be inherited by a symbol that precedes each
to be joined range.
<P>
A nested <CODE>NAMERangeSequence</CODE> may not occur between
<CODE>NAMEOpenSeqScope</CODE> and the first 
<BR> <CODE>NAMEOpenElemScope</CODE>.
<P>
The example given in See  <A HREF="name_4.html#SEC7">Joined Ranges</A> is here modified for the
bottom-up case.
<P>
We demonstrate the use of these facilities by extending the language
of our running example by introducing an artificial language
construct: It consists of a defining identifier occurrence,
that is to be bound in the enclosing range,
and two compound statements which form one single range in the sense
of scope rules.
<P>
We introduce two new symbols <CODE>BuJoin</CODE> and <CODE>BuJoinEl</CODE>
that derive to empty.
<P>
<PRE>
   Statement:      Join.
   Join:           'join' BuJoin DefIdent 
                          BuJoinEl Block BuJoinEl Block 
                   'joined' ';'.
   BuJoin:         .
   BuJoinEl:       .
</PRE>
<P>
The module roles are inherited as described above:
<P>
<PRE>
   RULE: Join ::= 'join' BuJoin DefIdent 
                         BuJoinEl Block BuJoinEl Block
                  'joined' ';'
   END;

   SYMBOL Join INHERITS RangeSequence END;
   SYMBOL BuJoin INHERITS OpenSeqScope END;
   SYMBOL BuJoinEl INHERITS OpenElemScope END;
   SYMBOL Block INHERITS RangeScope END;
</PRE>
<P>
<A NAME="IDX135"></A>
<A NAME="IDX136"></A>
<A NAME="IDX137"></A>
<A NAME="IDX134"></A>
<HR size=1 noshade width=600 align=left>
<P>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_3.html"><IMG SRC="gifs/prev.gif" ALT="Previous Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_5.html"><IMG SRC="gifs/next.gif" ALT="Next Chapter" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT=""><A HREF="name_toc.html"><IMG SRC="gifs/up.gif" ALT="Table of Contents" BORDER="0"></A>
<IMG SRC="gifs/empty.gif" WIDTH=25 HEIGHT=25 ALT="">
<HR size=1 noshade width=600 align=left>
</TD>
</TR>
</TABLE>

</BODY></HTML>
